package com.songshuai.webapi.permission.client;
import com.songshuai.webapi.permission.client.hystrix.UserServiceHystrix;
import com.songshuai.webapi.permission.dto.request.UserDto;
import com.songshuai.webapi.permission.dto.response.RespDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;

import java.security.Principal;


/**
 * Created by yubo on 2018/11/19.
 */

@FeignClient(value = "login-service",fallback = UserServiceHystrix.class )
public interface PermissionServiceClient {

    @PostMapping(value = "/user/{username}")
    RespDTO<UserDto> getUser(@RequestHeader(value = "Authorization") String token, @PathVariable("username") String username);

    @GetMapping(value = "/user/current")
    Principal getPrincipal(@RequestHeader(value = "Authorization") String token);
}



